home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / JAVA Utilities / JProxy 1.1.0 / customers / launch_browser.jsp < prev    next >
Encoding:
Text File  |  2003-04-29  |  7.1 KB  |  206 lines

  1. <%@ page language="java" import="
  2.     java.util.*,
  3.     com.jproxy.site.mbeans.JMXInvocator,
  4.     com.jproxy.site.mbeans.config.*,
  5.     com.jproxy.site.ejbeans.interfaces.ISaleFormula,
  6.     com.jproxy.site.*"
  7.     errorPage="../error-page.jsp"
  8. %>
  9.  
  10. <jsp:useBean id="buycustomers" scope="request" class="com.jproxy.site.customers.Buy"/>
  11. <%
  12. if (!buycustomers.ses.isLoggedIn()) {
  13. %>
  14.   <jsp:forward page="login.jsp">
  15.   </jsp:forward>
  16. <%
  17. }
  18. buycustomers.request(pageContext);
  19. buycustomers.ses.setNewHit(pageContext, "hits", "Customer Buy Page", null);
  20. %>
  21.  
  22. <%
  23. if(buycustomers.forwardPage.length()>0)
  24. {
  25. %>
  26.   <jsp:forward page="<%=buycustomers.forwardPage%>">
  27.   </jsp:forward>
  28. <%
  29. }
  30. %>
  31.  
  32. <%
  33. int purchasedLicenses = 0;
  34. if(buycustomers.getParameter("purchased-licenses").length()>0)
  35.     purchasedLicenses = new Integer(buycustomers.getParameter("purchased-licenses")).intValue();
  36. String customerName = buycustomers.customer.getCustomerName();
  37. String host = "http://"+request.getServerName()+":"+request.getServerPort();
  38.  
  39. boolean isDisabled = false;
  40. ISaleFormula formula = (ISaleFormula)buycustomers.formulas.elementAt(0);
  41.  
  42. int firstLicensePrice = formula.getFirstLicense();
  43. int additionalLicensePrice = formula.getAdditionalLicense();
  44. if(purchasedLicenses>0)
  45.     firstLicensePrice = additionalLicensePrice;
  46.  
  47. int amount = firstLicensePrice;
  48. int licenses = 1;
  49. int customerId = 0;
  50. int invoice = 0;
  51.  
  52. // find out the number of licenses requested
  53. if(request.getParameter("licenses")!=null)
  54. {
  55.     try{
  56.         licenses = new Integer(request.getParameter("licenses")).intValue();
  57.         if (licenses <= 0)
  58.             licenses = 1;
  59.     }
  60.     catch(Exception ee){}
  61. }
  62.  
  63. // calculate the total amount based on the number of licenses and the pricing model
  64. amount = firstLicensePrice + additionalLicensePrice * (licenses - 1);
  65.  
  66. if(request.getParameter("submit_recalculate")!=null)
  67. {
  68. }
  69. if(request.getParameter("submit_purchase")!=null && request.getParameter("error")==null)
  70. {
  71. %>
  72.     <jsp:forward page="purchase.jsp"/>
  73. <%
  74. }
  75. %>
  76.  
  77. <!-- HEADER -->
  78. <jsp:include page="../header.jsp" flush="true">
  79.   <jsp:param name="name" value="Buy JProxy Tunnel"/>
  80. </jsp:include>
  81.  
  82. <!-- MAIN PANEL -->
  83.  
  84.  
  85. <br>
  86. You're about to purchase licenses for your <span class="h9VerdanaBold"><%=customerName%></span> customer.
  87. <p>
  88. Once the payment is made the new total of purchased licenses will be altered in the Managing
  89. Console screen. Newly purchased licenses will be added to the total purchased licenses of this
  90. customer.
  91. <p>
  92. Please enter the number of host licenses you would like to purshase and click <b>Recalcualte</b> to get the updated price
  93. <p>
  94. <%
  95.     if(isDisabled)
  96.     {
  97. %>
  98.             <blockquote>
  99.               <p><b>Sorry, </b></p>
  100.               <p><b>The page is under construction.</b></p>
  101.               <p><b>E-Commerce is coming soon.</b></p>
  102.               <p><b>Get free feature limited JProxy release <a href="download.html">here</a>.</b></p>
  103.             </blockquote>
  104. <%
  105.     }
  106.     else
  107.     {
  108.  
  109.         ConfigMBean mbean = (ConfigMBean)JMXInvocator.getMBean(
  110.             "JProxy:service=JProxyConfigMBean", ConfigMBean.class);
  111.         String productName = mbean.get("com.jproxy.proxy.name") + " " + mbean.get("com.jproxy.proxy.version");
  112.         String invoiceStr = mbean.get("com.jproxy.commerce.invoice");
  113.         try{
  114.             invoice = Integer.parseInt(invoiceStr);
  115.         }
  116.         catch(Exception e){
  117.             invoice = 15;
  118.         }
  119. %>
  120. <br>
  121.   <table class="h9Verdana" cellpadding="5" width="600" border="0">
  122. <!-- Prolog -->
  123.     <tr>
  124.      <td>
  125.         <table class="h9Verdana" border="0" bgcolor="9c9cff" cellpadding="1" cellspacing="0">
  126.          <tr><td>
  127.            <%=productName%>
  128.          </td></tr>
  129.          <tr><td>
  130.                      <form method="get" action="buy.jsp">
  131.              <table class="h8Verdana" border="0" bgcolor="white" cellpadding="5" cellspacing="1" width="100%">
  132.               <tr>
  133.                <td align="left">
  134.                                   <br>
  135.                   Quantity:
  136.                   <input type="input" name="licenses" value="<%=licenses%>" size="3">
  137.                                   <INPUT TYPE=HIDDEN NAME="customer-id" VALUE="<%=buycustomers.customerID%>">
  138.                                    Licenses:
  139.                                    <input type="text" name="total" READONLY value="$<%=amount%>" size="8">
  140.                                    Technical Support:
  141.                                    <input type="text" name="total" READONLY value="$<%=(amount * 0.25) %>" size="8">
  142.                                    Order Total:
  143.                                    <input type="text" name="total" READONLY value="$<%=(amount + amount * 0.25) %>" size="8">
  144.                </td>
  145.               </tr>
  146.                           <tr>
  147.                <td class="h8Verdana" align="right">
  148.                             <INPUT TYPE=SUBMIT NAME=submit_recalculate WIDTH="20" VALUE="Recalculate">
  149.                </td>
  150.               </tr>
  151.             </table>
  152.                     </form>
  153.   <!-- begin separator -->
  154.           </td></tr>
  155.           <tr><td>
  156.   <!-- end separator -->
  157.            <table class="h8Verdana" width="100%" border="0" bgcolor="white" cellpadding="5" cellspacing="0" >
  158.             <tr>
  159.              <td align="left">
  160.                When you're ready to proceed to a secure payment form
  161.                please press the <b>Purchase</b> button
  162.              </td>
  163.              <td align="right">
  164.                <br>
  165.     <%
  166.     String headerHTML = "<font size=30 color=#6331CE>JProxy</font>";
  167.         headerHTML += "<font size=10 color=#9C00FF>.com</font>";
  168.     String footerHTML = "<font size=2><em>Copyright 2001-2002, JProxy</em></font>";
  169.     String description = "productName : "+productName+"<br>";
  170.         description += "Customer Name : "+customerName+"<br>";
  171.         description += "Licenses # : "+licenses;
  172.     %>
  173.                <FORM METHOD=POST ACTION="https://secure.authorize.net/gateway/transact.dll">
  174.           <INPUT TYPE=HIDDEN NAME="number_of_licenses" VALUE="<%=licenses%>">
  175.           <INPUT TYPE=HIDDEN NAME="customer-id" VALUE="<%=buycustomers.customerID%>">
  176.           <INPUT TYPE=HIDDEN NAME="parent-id" VALUE="<%=buycustomers.ses.getLogin().getID()%>">
  177.           <INPUT TYPE=HIDDEN NAME="x_amount" VALUE="<%=(amount + amount * 0.25)%>">
  178.           <INPUT TYPE=HIDDEN NAME="x_Version" VALUE="3.0">
  179.           <INPUT TYPE=HIDDEN NAME="x_Login" VALUE="jproxyllc">
  180.           <INPUT TYPE=HIDDEN NAME="x_Show_Form" VALUE="PAYMENT_FORM">
  181.           <INPUT TYPE=HIDDEN NAME="x_Cust_ID" VALUE="<%=customerId%>">
  182.           <INPUT TYPE=HIDDEN NAME="x_Invoice_Num" VALUE="<%=invoice%>">
  183.           <INPUT TYPE=HIDDEN NAME="x_Description" VALUE="<%=description%>">
  184.           <!-- INPUT TYPE=HIDDEN NAME="x_Logo_URL" VALUE="http://jproxy.com/main/resources/jproxy.gif" -->
  185.           <INPUT TYPE=HIDDEN NAME="x_Header_HTML_Payment_Form" VALUE="<%=headerHTML%>">
  186.           <INPUT TYPE=HIDDEN NAME="x_Footer_HTML_Payment_Form" VALUE="<%=footerHTML%>">
  187.           <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_Method" VALUE="GET">
  188.           <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_Text" VALUE="Click here to continue">
  189.           <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_URL" VALUE="<%=host%>/main/customers/purchase.jsp;jsessionid=<%=request.getSession().getId()%>">
  190.           <INPUT TYPE=SUBMIT NAME=submit_purchase WIDTH="20" VALUE="Purchase">
  191.                </FORM>
  192.              </td>
  193.             </tr>
  194.            </table>
  195.          </td></tr>
  196.         </table>
  197.      </td>
  198.     </tr>
  199.   </table>
  200. <%
  201.     }
  202. %>
  203.  
  204. <!-- FOOTER -->
  205. <jsp:include page="../footer.jsp" flush="true"/>
  206.